package day6.blocking_queue_impl;

import java.util.Scanner;
/**
 * 消费者阻塞，生产者唤醒
 */
public class Main {
    static MyArrayBlockingQueue queue = new MyArrayBlockingQueue(3);

    static class MyThread extends Thread {
        @Override
        public void run() {
            Scanner scanner = new Scanner(System.in);
            long e = scanner.nextLong();

            try {
                queue.put(e);
            } catch (InterruptedException interruptedException) {
                interruptedException.printStackTrace();
            }
        }
    }

    public static void main(String[] args) throws InterruptedException {
        MyThread t = new MyThread();
        t.start();

        long take = queue.take();
        System.out.println(take);
    }
}
